//
//  HMNavController.swift
//  sina
//
//  Created by Kent on 16/9/22.
//  Copyright © 2016年 Ming. All rights reserved.
//

import UIKit

class HMNavController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        
    }

    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        
        let count = childViewControllers.count
        
        if count > 0 {
        
            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "返回", imageName: "navigationbar_back_withtext", target: self, action: #selector(back))
            viewController.hidesBottomBarWhenPushed = true
            
        }
        
        super.pushViewController(viewController, animated: animated)
    }
    
    func back() {
        popViewController(animated: true)
    }
    
}
